Skip to content

fix: git issues list --repo silently accepts malformed repo filters and exact-matches untrimmed input - #1062

Closed
Martin-Blau wants to merge 1 commit into
entrius:testfrom
Martin-Blau:fix/git-issue-list
Closed

fix: git issues list --repo silently accepts malformed repo filters and exact-matches untrimmed input#1062
Martin-Blau wants to merge 1 commit into
entrius:testfrom
Martin-Blau:fix/git-issue-list

Conversation

@Martin-Blau

@Martin-Blau Martin-Blau commented May 7, 2026

Copy link
Copy Markdown

Summary

Fixes gitt issues list --repo so repository filters are normalized and validated before filtering issues.
Merged PR #910 added --repo <owner/name>, but the implementation compared raw user input directly against repository_full_name. That caused valid filters with surrounding whitespace to return no results, and malformed filters to be silently accepted.

Related Issue

Fixes: #1061

Real Behavior Proof

Before this change, gittensor/cli/issue_commands/view.py filtered with the raw CLI value:

if repo_filter and issue_id is None:
    issues = [
        i for i in issues
        if i.get('repository_full_name', '').lower() == repo_filter.lower()
    ]

So this valid input failed to match:

gitt issues list --repo " owner/repo "

And malformed inputs were accepted as filters:

gitt issues list --repo ownerrepo
gitt issues list --repo owner//repo
gitt issues list --repo https://github.com/owner/repo

Solution

issues_list now reuses the existing repository validator:

owner, repo_name = validate_repository(repo_filter, verify_exists=False)
repo_filter = f'{owner}/{repo_name}'

This makes --repo behavior consistent with other issue commands.

Updated Behavior

Whitespace-padded valid filters are normalized:

gitt issues list --repo " owner/repo "

now behaves like:

gitt issues list --repo owner/repo

Malformed filters now fail before contract reads with a bad parameter error.

Validation Notes

Added tests for:

  • --repo " owner/repo " in JSON mode
  • --repo " owner/repo " in human table mode
  • invalid --repo ownerrepo
  • invalid --repo owner//repo
  • invalid URL-like repo input
  • JSON bad_parameter response shape

Local checks run:

python3 -m py_compile gittensor/cli/issue_commands/view.py tests/cli/test_issues_list_json.py
git diff --check

Both passed.
Full pytest could not be run in this environment because pytest, uv, and pip are not installed.

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 7, 2026
@Martin-Blau

Martin-Blau commented May 7, 2026

Copy link
Copy Markdown
Author

@anderdc I fixed this issue on this PR #1062
Could you please review this PR? Thanks!

@PfanP

PfanP commented May 7, 2026

Copy link
Copy Markdown
Contributor

@John-pillo1124 Be patience, maintainers will check it on time

@anderdc anderdc closed this May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] gitt issues list --repo silently accepts malformed repo filters and exact-matches untrimmed input

3 participants